package com.lzy.product.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzy.framework.core.orm.db.Pager;
import com.lzy.framework.core.utils.DozerUtils;
import com.lzy.product.dao.OrderProjectRecordMapperExt;
import com.lzy.product.dtos.OrderProjectRecordDto;
import com.lzy.product.dtos.statistics.OrderProjectParamDto;
import com.lzy.product.dtos.statistics.OrderProjectRecordVoDto;
import com.lzy.product.entity.OrderProjectRecord;
import com.lzy.product.service.OrderProjectRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * 订单产品包含项记录服务
 * Created by WIN7 on 2017/12/13.
 */
@Service
public class OrderProjectRecordServiceImpl implements OrderProjectRecordService{
    @Autowired
    private OrderProjectRecordMapperExt orderProjectRecordMapperExt;

    @Override
    public Long insert(OrderProjectRecordDto dto) {
        OrderProjectRecord orderProjectRecord = DozerUtils.map(dto, OrderProjectRecord.class);
        return orderProjectRecordMapperExt.insertSelective(orderProjectRecord) > 0 ? orderProjectRecord.getId() : null;
    }

    @Override
    public Boolean update(OrderProjectRecordDto dto) {
        return null;
    }

    @Override
    public Boolean delete(Long id) {
        return null;
    }

    @Override
    public Boolean remove(Long id) {
        return null;
    }

    @Override
    public OrderProjectRecordDto findById(Long id) {
        return null;
    }

    @Override
    public List<OrderProjectRecordDto> query(OrderProjectRecordDto dto) {
        return null;
    }

    @Override
    public List<OrderProjectRecordDto> selectOrderProjectRecordByOrderId(Long id) {
        return orderProjectRecordMapperExt.selectOrderProjectRecordByOrderId(id);
    }

    @Override
    public PageInfo<OrderProjectRecordVoDto> queryDayProjectList(Pager pager, OrderProjectParamDto paramDto) {
        if (pager != null) {
            PageHelper.startPage(pager.getPageNum(), pager.getPageSize());
        }
        List<OrderProjectRecordVoDto> list = orderProjectRecordMapperExt.queryDayProjectList(paramDto);
        return new PageInfo<>(list);
    }

    @Override
    public Integer getQueryProject(OrderProjectParamDto paramDto) {
        return orderProjectRecordMapperExt.getQueryProject(paramDto);
    }
}
